    <div class="container containerShadow">
        <div class="row">
            <div class="topimg">
                <div class="left pull-left">
                    <span>基本信息</span>
                </div>
                <!--<div class="pull-right">
                <a href="###">
                <img src="image/projectDetails/edit.png" >
                </a>
            </div>-->
            </div>
            <form id="jiBenXinXi" onsubmit="return validate_form()">
                <p class="clearfix">
                    <label for="" class="pull-left">项目名称
                        <input type="text" autofocus="autofocus" id="title" class="pull-right" value="<?= !empty($Base['title'])?$Base['title']:'' ?>"/>
                    </label>

                    <label for="xiangMuBianHao" class="pull-right">项目编号
                        <input type="text" class="pull-right" id="code" value="<?= !empty($Base['code'])?$Base['code']:'' ?>" readOnly="true"/>
                    </label>

                </p>
                <p class="clearfix">
                    <label for="" class="pull-left">项目类型
                        <select name="" class="pull-right" id="projeactType">
                            <?php
                            $projectCategory = Yii::$app->params['projectCategory'];
                            foreach ($projectCategory as $k => $v){
                                if ($k == $Base['type2']){
                                    echo"<option value='".$v['val']."' selected='selected'>".$v['name']."</option>";
                                }else{
                                    echo"<option value='".$v['val']."'>".$v['name']."</option>";
                                }
                            }
                            ?>
                        </select>
                    </label>

                    <label for="" class="pull-right">省份地区
                        <?php
                        $provinceID = $Base['province'];
                        ?>
                        <select name="" class=""  id="province">
                            <option  value='0' <?= $provinceID==0?'selected':''?>>请选择</option>";
                            <?php
                            foreach ($provinceData as $k => $v) {
                                if ($provinceID==($k+1) && $provinceID!=0){
                                    echo "<option selected data-id=".$v['id']." value=".$v['id'].">".$v['title']."</option>";
                                }else{
                                    echo "<option  data-id=".$v['id']." value=".$v['id'].">".$v['title']."</option>";
                                }
                            }
                            ?>
                        </select>
                    <span class="selectText">省</span>
                     <select name="" class=" shiSelect"  id="city"></select>
                    <span class="selectText">市</span>
                   
                    </label>
                </p>
                <p class="clearfix">
                    <label for="" class="pull-left">所属行业</label>
                    <strong class="hangYe labelActiveBox pull-right" id="industry">
                        <?php
                        $industryVal = !empty($Base['industry']) ? array_filter(explode(',',$Base['industry'])) :'';
                        $industrys = Yii::$app->params['industrys'];
                        foreach ($industrys as $k => $v){
                            $name = $v['name'];
                            $val  = $v['val'];
                            $for  = $v['for'];
                            if (!empty($industryVal) && in_array($val,$industryVal)){
                                echo "<label for='".$for."' data-val=".$val."  class='labelActive'>".$name."</label><input type='checkbox' id='".$for."'/>";
                            }else{
                                echo "<label for='".$for."' data-val=".$val." >".$name."</label><input type='checkbox' id='".$for."'/>";
                            }
                        }
                        ?>
                    </strong>
                </p>
                <p class="enterpriseType" id="enterpriseS">
                    <label for="">企业类型</label>
                    <?php
                    $enterpriseVal = !empty($Base['enterprise']) ? array_filter(explode(',',$Base['enterprise'])) :'';
                    $enterprises = Yii::$app->params['enterprises'];
                    foreach ($enterprises as $k => $v){
                        $name = $v['name'];
                        $val  = $v['val'];
                        $for  = $v['for'];
                        if (in_array($val,$enterpriseVal)){
                            echo "<label for='".$for."' data-val=".$val."  class='typeActive'>".$name."<input type='radio' value='' name='enterpriseType' id='".$for."'/></label>";
                        }else{
                            echo "<label for='".$for."' data-val=".$val." >".$name."<input type='radio' value='' name='enterpriseType' id='".$for."'/></label>";
                        }
                    }
                    ?>

                </p>
                <p class="clearfix">
                    <label for="jiKuanMing" class="pull-left">借款人名称
                        <input type="text" class="pull-right" id="borrowerName" value="<?=!empty($Base['borrower'])?$Base['borrower']:''?>"/>
                    </label>
                    <label for="" class="pull-right">借款人状况
                        <select name="" class="pull-right" id="borrowerStatus">
                            <?php
                                $borrowerStatesSelected = !empty($Base['management_status']) ? intval($Base['management_status']) :'';
                                $borrowerStates = Yii::$app->params['borrowerStates'];
                                foreach ($borrowerStates as $k => $v){
                                    $name = $v['name'];
                                    $val  = $v['val'];
                                    if ($v['val'] == $borrowerStatesSelected){
                                        echo "<option value='".$val."' selected>".$name."</option>";
                                    }else{
                                        echo "<option value='".$val."'>".$name."</option>";
                                    }
                                }
                            ?>
                        </select>
                    </label>
                </p>
                <p class="clearfix">
                    <label for="" class="pull-left">保证人/抵押人
                        <input type="text" class="pull-right" id="guarantor" value="<?= !empty($Base['guarantor'])?$Base['guarantor']:'' ?>" name="guarantor"/>
                    </label>

                    <label for="" class="pull-right">保证人/抵押人状况
                        <input type="text"  class="pull-right" id="guarantorState" value="<?= !empty($Base['guarantor_status'])?$Base['guarantor_status']:'' ?>"/>
                    </label>

                </p>
                <p class="clearfix">
                    <label for="" class="pull-left">
                        <label for="" class="benJinBox">
                            本金（元）
                            <!--<input type ="text" class="pull-right" id="principal"  onkeyup="this.value=this.value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" onafterpaste="this.value=this.value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')"  value="<?= !empty($Base['principal'])?$Base['principal']:'';?>" name="principal">-->
                            	
                            <input type ="text" class="pull-right" id="principal"  onkeyup="true" isNumber='true'   value="<?= !empty($Base['principal'])?$Base['principal']:'';?>" name="principal">
                        </label>
                        <label for="" class="benJinBox" style="margin-top: 25px;"> 利息（元）
                        	   <input type="text" class="pull-right" id="interest" onkeyup="true" isNumber="true"    value="<?= !empty($Base['interest'])?$Base['interest']:'';?>" name="interest">
                         <!--   <input type="text" class="pull-right" id="interest"  onkeyup="this.value=this.value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" onafterpaste="this.value=this.value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')"  value="<?= !empty($Base['interest'])?$Base['interest']:'';?>" name="interest">-->
                        </label>
                    </label>

                    <label for="" class="pull-right"> 本息合计
                        <input type ="text" class="pull-right" id="benxi" disabled value="<?=$Base['principal']+$Base['interest'] ?>" name="benX">
                    </label>

                </p>
                <p class="clearfix diYaWuLieXing">
                    <label for="" class="pull-left">抵押物类型</label>
                    <strong class="labelActiveBox pull-right" id="mortgage_type">
                        <?php
                        $mortgagetypeVal = !empty($Base['mortgage_type']) ? array_filter(explode(',',$Base['mortgage_type'])) :'';
                        $mortgageTypess = Yii::$app->params['mortgageTypes'];
                        foreach ($mortgageTypess as $k => $v){
                            $name = $v['name'];
                            $val  = $v['val'];
                            $for  = $v['for'];
                            if (!empty($mortgagetypeVal) && in_array($val,$mortgagetypeVal)){
                                echo "<label for='".$for."' data-val=".$val."  class='labelActive'>".$name."</label><input type='checkbox' id='".$for."'/>";
                            }else{
                                echo "<label for='".$for."' data-val=".$val." >".$name."</label><input type='checkbox' id='".$for."'/>";
                            }
                        }
                        ?>
                    </strong>
                </p>
                 <p class="clearfix textarea">
                    <label for="" class="pull-left">担保方式</label>
                    <textarea class="pull-right textarea-edit" name="" rows="" cols="" id="warranty"><?= !empty($Base['warranty'])?$Base['warranty']:'';?></textarea>
                </p>
                <p class="suSongZhuangTai">
                    <label for="">诉讼状态</label>
                    <strong class="pull-right" id="is_suit">
                        <label for="yiSu">
                            <i <?= $Base['is_suit'] == 1 ? 'class="radioActive"' : ''?> data-val="1"></i>
                            <span >已诉</span>
                        </label>
                        <input type="radio" name="sunSongZhuangTai" id="yiSu" value="" />
                        <label for="weiSu">
                            <i <?= $Base['is_suit'] == 0 ? 'class="radioActive"' : ''?> data-val="0"></i>
                            <span>未诉</span>
                        </label>
                        <input type="radio" name="sunSongZhuangTai" id="weiSu" value="" />
                        <label for="buFenSu">
                            <i <?= $Base['is_suit'] == 2 ? 'class="radioActive"' : ''?> data-val="2"></i>
                            <span>部分诉讼</span>
                        </label>
                        <input type="radio" name="sunSongZhuangTai" id="buFenSu" value="" />
                    </strong>
                </p>
                <p class="clearfix textarea">
                    <label for="" class="pull-left">亮点说明</label>
                    <textarea class="pull-right textarea-edit" name="highlights" rows="" cols="" id="highlights"><?= !empty($Base['highlights'])?$Base['highlights']:'';?></textarea>
                </p>
                <div class="cancelInConfirm">
                    <!--<input id="confirm" type="submit" value="保存" id="confirm"/>-->
                    <input  id="ajaxBase" class="cancelInConfirmActive" type="button" value="保存" />
                    <input id='cancel' type="button" value="取消" />
                </div>

            </form>
        </div>
    </div>
    
	<!-- textarea 高度设置对比div -->
	<div style="overflow: hidden; height: 0px;">
		<div id="d1" style="visibility:hidden;min-height: 80px!important;"></div>
	</div>
<script>
 $(function () {
//	// 	高亮显示开始
//	var listArr = ['input','select','textarea'];
//	listArr.forEach(function(value,index,arr){
//	
//		$(value).focus(function(){
//			$(this).css({
//				"border":"1px solid #2194f1"
//			})
//		})
//		$(value).blur(function(){
//			$(this).css({
//				"border":"1px solid #e2e2e2"
//			})
//		})
//	})
//	// 	高亮显示 结束
    	
//	 		 前端表单验证开始
			 
	    $.validator.setDefaults({
		   debug: true
		})
	    	   
		 $('#jiBenXinXi').validate({})
		 //	 前端表单验证结束
		
        var title    = ''; //项目名称
        var code    = ''; //项目编号
        var projeactType = ''; //项目类型
        var province = '';   //省份
        var city = '';   //省份
        var enterprise = ''; //企业类型
        var borrowerName = '';//借款人名称
        var borrowerStatus = ''; //借款人状况
        var guarantor = ''; //保证人/抵押人
        var guarantorState = ''; //保证人/抵押人状态
        var principal = ''; //本金（元）
        var interest = ''; //利息（元）
        var benxi = ''; //本息和（元）
        //按键获取想加的总和
        $("#principal,#interest").keyup(function () {
            principal = $("#principal").val()=='' ? 0 :$("#principal").val();
            interest = $("#interest").val()==''?0:$("#interest").val();
            sumMoney = parseFloat(interest.replace(/,/g,'')) + parseFloat(principal.replace(/,/g,''));
            $("#benxi").val(sumMoney)
        })
        //ajax 保存数据
        $('.cancelInConfirm').on('click','#ajaxBase',function(){
            var industry = ''; //所属行业
            var mortgage_type = ''; //抵押物类型
            var is_suit = ''; //诉讼状态
            var warranty = ''; // 担保方式
            //--------------------------项目名称/项目编号/项目类型/省份/借款人名称/借款人状况/保证人/抵押人/保证人/抵押人状态/本金（元）/利息（元）/本息和（元）/亮点明细---start----------------
            title = $("#title").val();
            code = $("#code").val();
            projeactType = $("#projeactType option:selected").val();
            province = $("#province option:selected").val();
            city = $("#city option:selected").val();
                borrowerName = $("#borrowerName").val();
            borrowerStatus = $("#borrowerStatus option:selected").val();
            guarantor = $("#guarantor").val();
            guarantorState = $("#guarantorState").val();
            principal = $("#principal").val();
            interest = $("#interest").val();
            benxi = $("#benxi").val();
            highlights = $("#highlights").val();
            warranty = $("#warranty").val();
            //--------------------------项目名称/项目编号/项目类型/省份------end-------------
            //--------------------------获取所属行业的值---start----------------
            $('#industry').find('label').each(function() {
                    if($(this).attr('class') == 'labelActive'){
                        industry+=$(this).data('val')+',';
                    }
            })
            if (industry.length > 0){
                industry = industry.substr(0,industry.length-1)
            }
            //--------------------------获取所属行业的值---end----------------
            //--------------------------企业类型---start----------------
            $('#enterpriseS').find('label').each(function() {
                if($(this).attr('class') == 'typeActive'){
                    enterprise = $(this).data('val');
                }
            })

            //--------------------------企业类型---end----------------
            //--------------------------抵押物类型---start----------------
            $('#mortgage_type').find('label').each(function() {
                if($(this).attr('class') == 'labelActive'){
                    mortgage_type+=','+$(this).data('val');
                }
            })
            if (mortgage_type.length > 0){
                mortgage_type = mortgage_type.slice(1,mortgage_type.length)
            }
            //--------------------------抵押物类型---end----------------
            //--------------------------诉讼状态---start----------------
            $('#is_suit').find('label').each(function() {
                if($(this).find('i').attr('class') == 'radioActive'){
                    is_suit =$(this).find('i').data('val');
                }
            })
            //--------------------------诉讼状态---end----------------
            //--------------------------post数据---start----------------
            var data={
                'industry':industry,
                'title':title,
                'code':code,
                'projeactType':projeactType,
                'province':province,
                'city':city,
                  'enterprise':enterprise,
                'borrowerName':borrowerName,
                'borrowerStatus':borrowerStatus,
                'guarantor':guarantor,
                'guarantorState':guarantorState,
                'principal':principal,
                'interest':interest,
                'benxi':benxi,
                'mortgage_type':mortgage_type,
                'is_suit':is_suit,
                'highlights':highlights,
                'warranty':warranty,
                'project_id':project_id,
                'package_id':package_id,
            };
            $.post('/project/ajax-save-base-project',{'data':data},function (res) {
                var JSONData = JSON.parse(res)
                if (JSONData.code == 200){
                    layer.msg(JSONData.message);
                    baseW();
                }else{
                    layer.msg(JSONData.message);
                }
            })
            //--------------------------post数据---end----------------
        })
        //-----------------渲染无编辑页面--------------------
        function baseW() {
                $.get('/project/get-base-data',{'project_id':project_id,'postion':2},function (res) {
                    $(".jiBenXinXiW").children().remove();
                    $(".jiBenXinXiW").html(res);
                    $("#jiBenXinXiEdit").hide();
                    $(".jiBenXinXiW").show();
                })
        }
        //ajax 调用 二级城市
        $("#province").change(function () {
            var provinceId = $(this).val();
            if (provinceId !=0 ){
                $.get('/search-package/ajax-city',{'provinceID':provinceId},function (res) {
                    var resData = JSON.parse( res );
                    console.log(resData);
                    if (resData.code==200){
                        rendering(resData.data.res);
                    }else{
                        alert("错误")
                    }
                })
            }else{
                var cityHtml0="<option value='' selected=''>请选择</option>";
                $("#city").html("");
                $("#city").append(cityHtml0);
            }
        })
        //刷新页面加载城市数据
        var getProvinceID = '<?=  $Base['province'] ?>';
        $().ready(function(){
            if (getProvinceID != 0){
                $.get('/search-package/ajax-city',{'provinceID':getProvinceID},function (res) {
                    var resData = JSON.parse( res );
                    if (resData.code==200){
                        rendering(resData.data.res);
                    }else{
                        alert("错误")
                    }
                })
            }
        })
        var cityID = '<?=  $Base['city'] ?>';
        function rendering(res) {
            var cityHtml = "";
            $(res).each(function(i,e){
                var title = e.title;
                var id    = e.id;
                if (cityID==id){
                    cityHtml+= "<option selected value='"+id+"'>"+title+"</option>";
                }else{
                    cityHtml+= "<option value='"+id+"'>"+title+"</option>";
                }
            });
            cityHtml="<option value='' selected=''>请选择</option>"+cityHtml;

            $("#city").html("");
            $("#city").append(cityHtml);
        }
        $("#cancel").click(function () {
            $.post('/project/ajax-un-lock',{'postion':2,'project_id':project_id},function (res) {
                var JSONData = JSON.parse(res)
                if (JSONData.code == 200){
                    layer.msg(JSONData.message);
                }else{
                    layer.msg(JSONData.message);
                }
            })
            $("#jiBenXinXiEdit").hide();
            $(".jiBenXinXiW").show();
        })

     $('#city').select2({
         language: "zh-CN",  //设置 提示语言
         width: '160px', //设置下拉框的宽度
         tokenSeparators: [',', ' '],
         placeholder: "请选择城市",  //提示语
         maximumSelectionLength :30,   //限制搜索的个数
         tags: false                //可以手动添加，若限制手动添加，设置为false
     })

     $('#province').select2({
         language: "zh-CN",  //设置 提示语言
         width: '160px', //设置下拉框的宽度
         tokenSeparators: [',', ' '],
         placeholder: "请选择省",  //提示语
         //maximumSelectionLength :30,   //限制搜索的个数
         tags: false                //可以手动添加，若限制手动添加，设置为false
     })
 })

    //所属行业
    $('.jiBenXinXi .labelActiveBox').on('click', 'label', function() {
        $(this).toggleClass('labelActive');
        // 获取当前label对应input的值
        //		var str = $(this).attr('for')
        //		console.log($('#'+str).prop('checked'))
    })
    //基本信息中的企业类型

    $('.enterpriseType input[name="enterpriseType"]').on('click', function() {
//      console.log($(this).is(':checked'))
//      console.log($(this).prev().find("iput").is(':checked'))
        if($(this).is(':checked')) {
            $($(this)).parent().addClass('typeActive').siblings().removeClass('typeActive');
        }
    })
    //诉讼状态
    $('.suSongZhuangTai strong').on('click', 'label', function() {
        // 获取当前label对应input的值
        var str = $(this).attr('for')
        //		console.log($('#'+str).is(':checked'))
        $(this).children('i').addClass('radioActive');
        $(this).siblings('label').children('i').removeClass('radioActive');
    })
  
</script>